Skip to content

Conversation

@chenhuiyeh
Copy link
Contributor

@chenhuiyeh chenhuiyeh commented Jun 5, 2025

This pull request introduces a new feature targeting MySQL version 8 and above, where the concept of invisible indexes has been introduced. Specifically, this PR adds a Visible field to the schema.Index struct, allowing users to easily filter out invisible indexes.

We encountered an issue with ghostferry where an invisible index was mistakenly selected as the shardingKeyIndexName. To address this, we initially applied a patch directly to the ghostferry project, as documented in ghostferry PR #383. This current PR seeks to integrate those changes into the upstream codebase for broader applicability. Part of Shopify/ghostferry#384.

@chenhuiyeh chenhuiyeh force-pushed the add-visible-field-to-schema branch from 3af6107 to c7a82aa Compare June 5, 2025 21:35
@chenhuiyeh chenhuiyeh marked this pull request as ready for review June 5, 2025 21:47
Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

@chenhuiyeh chenhuiyeh changed the title Add visible field to schema Add visible field to schema Index Jun 10, 2025
@chenhuiyeh chenhuiyeh force-pushed the add-visible-field-to-schema branch from d43319a to d108d09 Compare June 10, 2025 02:49
Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest lgtm

schema/schema.go Outdated
// Only set to false if explicitly marked as invisible
if hasInvisibleIndex {
visible, _ := r.GetString(i, 13)
if isIndexInvisible(visible) {
Copy link
Collaborator

@lance6716 lance6716 Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe

currentIndex.Visible = !isIndexInvisible(visible)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the two functions fetchIndex and fetchIndexesViaSqlDB to use currentIndex.Visible = !isIndexInvisible(visible)

@chenhuiyeh chenhuiyeh force-pushed the add-visible-field-to-schema branch from 1ad4c60 to 7f2a2be Compare June 10, 2025 10:38
@lance6716 lance6716 merged commit 447a516 into go-mysql-org:master Jun 11, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants